package com.blog.admin;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * Created by ${wangjian} on 2017/10/16.
 */
public class LoginValidator extends Validator {
    {
        setShortCircuit(true);
    }
    @Override
    protected void validate(Controller c) {
        if (null == c.getSession().getAttribute("user")) {
            addError("error","");
        }
    }

    @Override
    protected void handleError(Controller c) {
        c.redirect("/blog/admin");
    }
}
